<html>
<head>
<meta charset="UTF-8">
<title>审批插件配置修改</title>
<link id="easyuiTheme" href="../../static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
<link href="../../static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
<link href="../../static/css/esaas-easyui-edit.css" rel="stylesheet" type="text/css"/>
<script src="../../static/easyui/jquery.min.js" type="text/javascript"></script>
	<script src="../../static/easyui/jquery.cookie.js" type="text/javascript"></script>
	<script src="../../static/easyui/ui-theme.js" type="text/javascript"></script>
<script src="../../static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
<script src="../../ffres/dict/all.js" type="text/javascript"></script>
<a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<body class="easyui-layout" scroll="no">
	<form id="ff" method="post">
		<div class="esaas-info-title">审批插件配置信息</div>
		<table class="esaas-info-edit-table">
			<tr>
				<td width="15%" align="right" style="display:none">插件配置信息标识：</td>
				<td width="35%" style="display:none"><input class="easyui-textbox" type="text" readOnly
					name="pluginConfId" data-options="required:true"
					style="width: 100%; height: 25px;"></input></td>
				
			</tr>
			<tr>
				<td width="15%" align="right">审批机构名称：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					id="approveOrgName" name="approveOrgName" data-options="required:false"
					style="width: 92%; height: 25px;"></input><input type="button" style="width: 8%; height: 25px;" 
					value="..."  class="easyui-textbox" id="chooseOrg"></input></td>
				<td width="15%" align="right">审批机构标识：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="approveOrgId" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>		
			</tr>
			<tr>
				<td width="15%" align="right">审批岗位名称：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="approveDutyName" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td> 
				<td width="15%" align="right">审批岗位标识：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="approveDutyId" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">审批人名称：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					id="approveUserName" name="approveUserName" data-options="required:false"
					style="width: 92%; height: 25px;"></input><input type="button" style="width: 8%; height: 25px;" 
					value="..."  class="easyui-textbox" id="chooseApproveUser"></input></td>
				<td width="15%" align="right">审批人标识</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="approveUserId" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
				
			</tr>
			<tr>
				<td width="15%" align="right">审批人可用审批意见：</td>
				<td width="35%">
					<select class="easyui-combobox"
						id="approveAvailOpinion" name="approveAvailOpinion"
						style="width: 100%; height: 25px;" 
						data-options="multiple:true,required:false,editable:false,valueField:'enname',textField:'cnname',data:APPROVE_AVAIL_OPINION">
				</td>
					
			</tr>
			<tr>
			    <td width="15%" align="right">抄送人名称：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					id="copyUserName" name="copyUserName" data-options="required:false"
					style="width: 92%; height: 25px;"></input><input type="button" style="width: 8%; height: 25px;" 
					value="..."  class="easyui-textbox" id="chooseCopyUser"></input></td>		
				<td width="15%" align="right">抄送人标识：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="copyUserId" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
			<tr>
				<td width="15%" align="right">抄送人可用审批意见：</td>
				<td width="35%"><input class="easyui-textbox" type="text" 
					name="copyAvailOpinion" data-options="required:false"
					style="width: 100%; height: 25px;"></input></td>
			</tr>
		</table>
	</form>
	<div class="esaas-info-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton " iconCls="icon-ok" onclick="submitForm()" style="width:90px">&nbsp;保&nbsp;存&nbsp;</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="closeForm()" style="width:90px">&nbsp;关&nbsp;闭&nbsp;</a>
	</div>
	<script>

		$(function() {
            addTitle("修改");

            var pluginConfId = $.getUrlParam('pluginConfId');
			$.restfulGet('../../api/plugin/approve/conf/' + pluginConfId,null,function(data){
					$('#ff').form('load', {
						pluginConfId : data.rows.pluginConfId,
						approveOrgId : data.rows.approveOrgId,
						approveOrgName : data.rows.approveOrgName,
						approveDutyId : data.rows.approveDutyId,
						approveDutyName : data.rows.approveDutyName,
						approveUserId : data.rows.approveUserId,
						approveUserName : data.rows.approveUserName,
						approveAvailOpinion : data.rows.approveAvailOpinion ? data.rows.approveAvailOpinion.split(",") : [],
						copyUserId : data.rows.copyUserId,
						copyUserName : data.rows.copyUserName,
						copyAvailOpinion : data.rows.copyAvailOpinion,
						countersignStrategy : data.rows.countersignStrategy
					});					
			});
		});
		
		$(function() { 
	 		var pluginConfId = $.getUrlParam('pluginConfId');
            $('#chooseOrg').textbox('textbox').bind('click', function() {  
            	JLEUtil.createModalWin('选择机构', 'popSOrgChoice.html?' + 'pluginConfId=' + pluginConfId);
			});
			 $('#chooseApproveUser').textbox('textbox').bind('click', function() {  
	            	JLEUtil.createModalWin('选择审批人', 'popSUserChoice.html?' + 'userName='+'approveUserName'+'&pluginConfId=' + pluginConfId);
				});
			 $('#chooseCopyUser').textbox('textbox').bind('click', function() {  
	            	JLEUtil.createModalWin('选择抄送人', 'popSUserChoice.html?' + 'userName='+'copyUserName'+ '&pluginConfId=' + pluginConfId);
				});
        });
		// 选择内部服务回调
        function onChooseOrgName(row) {
        	$('#ff').form('load', {
				approveOrgName : row.organname
			});	
        }
     // 选择内部服务回调
        function onChooseApproveUserName(row) {
        	$('#ff').form('load', {
				approveUserName : row.actorname
			});	
        }
     // 选择内部服务回调
        function onChooseCopyUserName(row) {
        	$('#ff').form('load', {
				copyUserName : row.actorname
			});	
        }
     
		function submitForm() {
			if (!$('#ff').form('validate'))
				return;
			var jsonData = $("#ff").serializeJson();
			if (jsonData.approveAvailOpinion) {
				var test=jsonData.approveAvailOpinion;
				jsonData.approveAvailOpinion = jsonData.approveAvailOpinion.join(",");
			}
			$.restfulPut('../../api/plugin/approve/conf', jsonData, function(data) {
				if (window.parent.reloadList) {
					window.parent.reloadList();
				}
			});
		};
		
		function closeForm(){
			window.parent.JLEUtil.closewin();
		}
	</script>
</body>
</html>
